// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "DefaultMenu.generated.h"

/**
 * 
 */
UCLASS()
class MULTIPLAYERSESSIONS_API UDefaultMenu : public UUserWidget
{
	GENERATED_BODY()


public:
	UFUNCTION(BlueprintCallable)
	void MenuSetup(FString MainPath = FString(TEXT("/Game/GR/Maps/MainMap")));

protected:
	virtual bool Initialize() override;
	virtual void NativeDestruct() override;

	
	void OnCreateSession(bool bWasSuccessful) const;
	void OnFindSession(const TArray<FOnlineSessionSearchResult>& SessionResults, bool bWasSuccessful) const;

	UFUNCTION(BlueprintCallable)
	void FindSession();

	void OnJoinSession(EOnJoinSessionCompleteResult::Type Result) const;

private:
	class UMultiplayerSessionsSubsystem* MultiplayerSessionsSubsystem;

	UPROPERTY(meta=(BindWidget))
	class UListView* ListViewFindSession;
	UPROPERTY(meta=(BindWidget))
	class UCanvasPanel* CanvasFindSession;
	UPROPERTY(meta=(BindWidget))
	class UTextBlock* TextNoResults;
	UPROPERTY(meta=(BindWidget))
	class UCircularThrobber* Loading;

	FString PathToMain{TEXT("")};

};
